#ifndef DRAWWIDGET_H
#define DRAWWIDGET_H

#include <QMouseEvent>
#include <QPixmap>
#include <QWidget>

class DrawWidget : public QWidget
{
    Q_OBJECT

public:
    DrawWidget(QWidget *parent = 0);
    virtual ~DrawWidget();

    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void resizeEvent(QResizeEvent *) override; // 窗体大小改变事件

private:
    QPixmap *pixmap_;
    int width_;
    int height_;
    QVector<QVector<QPoint>> lines_;
};

#endif // DRAWWIDGET_H
